<html>
<body>

<?php

//http://stackoverflow.com/questions/1498628/how-can-you-integrate-a-custom-file-browser-uploader-with-ckeditor

require_once 'file.inc';

$callback = $_GET['CKEditorFuncNum'];

$uploadDirPath = '../upload';
$fpath = '';
$err = '';

try 
{
	$fpath = str_replace('../','/',File::upload('upload',$uploadDirPath));
}
catch (Exception $e)
{
	$err = "$e";
}

?>

<script type="text/javascript">
	window.parent.CKEDITOR.tools.callFunction(
		<?php echo $callback; ?>,
		'<?php echo $fpath; ?>',
		'<?php echo $err; ?>'
	);
</script>

</body>
</html>